const Service = require('egg').Service;

class BlogService extends Service {
  async add() {
    const { app } = this.ctx;
    const { title, content, author } = this.ctx.request.body;
    let data = await app.mysql.query(`insert into blogs (title, content, author) values (?,?,?)`, [title, content, author]);
    return { code: 0, msg: 'success', data }
  }
}

module.exports = BlogService